<script lang="ts">

  import router from '@/router'
  import axios from 'axios'

  export default {
    mounted() {
      console.log('mounted')
    },
    methods: {
      downloadBasic: function() {
        axios.get('src/assets/config.json')
          .then(response => axios.get(`${response.data.url}download_basic`, { method: 'GET' }))
          .then(response => console.log(response))
          .catch(err => console.log(err))
      },
      downloadDaily: function() {
        axios.get('src/assets/config.json')
          .then(response => axios.get(`${response.data.url}download_daily`, { method: 'GET' }))
          .then(response => console.log(response))
          .catch(err => console.log(err))
      },
      downloadStockHolderNumber: function() {
        axios.get('src/assets/config.json')
          .then(response => axios.get(`${response.data.url}download_all_stk_holdernumber`, { method: 'GET' }))
          .then(response => console.log(response))
          .catch(err => console.log(err))
      },
      downloadHighStock: function() {
        axios.get('src/assets/config.json')
          .then(response => axios.get(`${response.data.url}download_high_stock`, { method: 'GET' }))
          .then(response => console.log(response))
          .catch(err => console.log(err))
      },
      calHighStockHolder: function() {
        axios.get('src/assets/config.json')
          .then(response => axios.get(`${response.data.url}cal_high_stock`, { method: 'GET' }))
          .then(response => console.log(response))
          .catch(err => console.log(err))
      },
      reduceStockHolder: function() {
        router.push({ name: 'stockHolder' })
      },
      calNorm: function() {
        axios.get('src/assets/config.json')
          .then(response => axios.get(`${response.data.url}oversold`, { method: 'GET' }))
          .then(response => console.log(response))
          .catch(err => console.log(err))
      },
      jumpNormList: function() {
        router.push({ name: 'normList' })
      }
    }
  }

</script>

<template>
    <button class="button" @click="downloadBasic()">下载基础数据</button>
    <button class="button" @click="downloadDaily()">下载每天指标</button>
    <button class="button" @click="downloadStockHolderNumber()">下载股东数据</button>
    <button class="button" @click="downloadHighStock()">下载优质股东数据</button>
    <button class="button" @click="calHighStockHolder()">优质股东数据</button>
    <button class="button" @click="reduceStockHolder()">股东减少</button>
    <button class="button" @click="calNorm()">指标计算</button>
    <button class="button" @click="jumpNormList()">指标展示</button>
</template>

<style>
    .button {
        margin: 40px;
    }
</style>
